<?php 
header('Content-Type: text/html; charset=utf-8');
 
include_once("../c/config.php");

$access_token='https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.$appId.'&secret='.$secret;
$access = file_get_contents($access_token);
$accessObj = json_decode($access);
var_dump($accessObj);
$access_token = $accessObj->access_token;
 
$openid='oe2K2jjniX57VFTjLyP5wO7G3-to';
$url='https://api.weixin.qq.com/cgi-bin/user/info?access_token='.$access_token.'&openid='.$openid.'&lang=zh_CN';
$data=file_get_contents($url);
var_dump($data);


exit;
$access_token = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid='.$appId.'&secret='.$secret.'&code='.$_GET['code'].'&grant_type=authorization_code';
$access = file_get_contents($access_token);
$accessObj = json_decode($access);
$access_token = $accessObj->access_token;
$openid   = $accessObj->openid; //oe2K2jjniX57VFTjLyP5wO7G3-to
$user_info_url = 'https://api.weixin.qq.com/sns/userinfo?access_token='.$access_token.'&openid='.$openid.'&lang=zh_CN';
$userInfoObj = json_decode(file_get_contents($user_info_url));

var_dump($userInfoObj);
  